<?php
include("d:/collect_new/collect/reset/json_fx.php");
$httpheader=<<<TEXT
POST https://trade.taobao.com/trade/itemlist/asyncSold.htm?event_submit_do_query=1&_input_charset=utf8& HTTP/1.1
Host: trade.taobao.com
Connection: keep-alive
Content-Length: 2480
sec-ch-ua: " Not A;Brand";v="99", "Chromium";v="98", "Google Chrome";v="98"
DNT: 1
sec-ch-ua-mobile: ?0
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.102 Safari/537.36
Content-Type: application/x-www-form-urlencoded; charset=UTF-8
Accept: application/json, text/javascript, */*; q=0.01
X-Requested-With: XMLHttpRequest
bx-v: 2.2.3
sec-ch-ua-platform: "Windows"
Origin: https://trade.taobao.com
Sec-Fetch-Site: same-origin
Sec-Fetch-Mode: cors
Sec-Fetch-Dest: empty
Referer: https://trade.taobao.com/trade/itemlist/list_sold_items.htm?spm=a2oq0.12575281.seller-qn-head.2.231f1debr7vRTv&mytmenu=ymbb
Accept-Encoding: gzip, deflate, br
Accept-Language: en-US,en;q=0.9,zh-CN;q=0.8,zh;q=0.7,ja;q=0.6,bg;q=0.5,zh-TW;q=0.4,ru;q=0.3,th;q=0.2
Cookie:mt=ci%3D-1_0; DI_T_=7VjQ9AVLdYYZwSzDoig8JtwQR5AhuUGMW3kYZxqX9u4feF7ZRaC; thw=cn; _uetvid=0557ec60bad511ec86b6a910353440e0; _ga=GA1.2.996871457.1649818462; _ga_YFVFB9JLVB=GS1.1.1649818458.1.0.1649818469.0; enc=Pt3b5LKkszRTtAxr6draakLl6Hgbl%2BZtWdOsK2F%2Bdnu6MNMYdDxSWixo69oa5EY3MtY2nnBvKTVV2yM032mhBQ%3D%3D; useNativeIM=false; _bl_uid=RRlk29vzcXIcgtoXR8Rqona6m411; t=2c049269b8c48f396672aa0cdc702f7e; _m_h5_tk=a7c6cfac5a97e9f16107b7bff32cb88b_1666580752720; _m_h5_tk_enc=d9ee2d2b581d3832acc77b9d5d998d86; cookie2=19da2d472df7ba2825e3ba6affcc4d55; _tb_token_=76eed3e73a5b3; _samesite_flag_=true; xlly_s=1; sgcookie=E100VtM5QIuBkXy9V5qd%2FC4U6vILRTVkfaOIgnehqGQUpXCF582MtHV7qPNUpQHpcLiJTq7kE%2BOl7UG1W1F5iVDd1b6DfkoJCKoM9db5rUzAuSI%3D; unb=2200764680706; sn=%E5%B9%BF%E8%A5%BF%E5%A4%8D%E5%8D%8E%3A%E9%BA%A6%E6%98%86; csg=5975b94d; cancelledSubSites=empty; skt=a71b6f0e148e554b; _cc_=VT5L2FSpdA%3D%3D; cna=R+JfG64jZAoCAbSNMm4+rN4m; uc1=cookie21=U%2BGCWk%2F7oPIg&cookie14=UoeyCGMF4cK1tg%3D%3D; tfstk=c7SAByVwK7V0ilVM4nUkQjrLdt6AaiZwNjOsXMI0U7K-hYotfsv1xMFN3o9MTIeR.; l=eBM3WLwPTiGURtXUBO5Z-urza77TfIOfhsPzaNbMiInca1zAwHheaNCUFZIMkdtj_tfATetzQ4is6devPq4U-FOYRX-1rHp2dqv9-; isg=BCYmhLdNeeSJnS1HGic2kS7md5yoB2rBGySYwhDOeMlQk8CteJOV0Nkt74cfO2LZ

auctionType=0&close=0&pageNum=1&pageSize=5000&payDateBegin=0&payDateEnd=0&queryMore=false&rxAuditFlag=0&rxElectronicAllFlag=0&rxElectronicAuditFlag=0&rxHasSendFlag=0&rxOldFlag=0&rxSendFlag=0&rxSuccessflag=0&rxWaitSendflag=0&sellerMemo=0&tradeTag=0&useCheckcode=false&useOrderInfo=false&errorCheckcode=false&action=itemlist%2FSoldQueryAction&queryLabelValues=%5B%7B%22label%22%3A%22%E8%AE%A2%E5%8D%95%E7%BC%96%E5%8F%B7%22%2C%22value%22%3A%22%22%2C%22index%22%3A7%7D%2C%7B%22label%22%3A%22%E4%B9%B0%E5%AE%B6%E6%98%B5%E7%A7%B0%22%2C%22value%22%3A%22%22%2C%22index%22%3A4%7D%2C%7B%22label%22%3A%22%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zfq9597g1VPW5kHVhw2tlAA+8WkW/PqOK&bx-umidtoken=GF02BC91395C5CB714304191940043F7A83F6641801BCDCF565

TEXT;

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://collect1.longsunhd.com/collect/reset/json.php?getPhpCode=1");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true );
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:51.0) Gecko/20100101 Firefox/51.0');
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 15);
curl_setopt($ch, CURLOPT_POST, true );
curl_setopt($ch, CURLOPT_POSTFIELDS, array("httpheader"=>$httpheader));
curl_setopt($ch, CURLINFO_HEADER_OUT, 1);
$result=curl_exec($ch);
$request_header = preg_replace("/^((POST|GET)\s*[^\s]+)\s+http/Uixs","\\1&XDEBUG_SESSION_START=543534 HTTP",curl_getinfo($ch, CURLINFO_HEADER_OUT)).http_build_query(array("httpheader"=>$httpheader))."\r\n\r\n";
$request_header = preg_replace('/Content\-Type\:[^\r\n]+/imx','Content-Type: application/x-www-form-urlencoded',$request_header);
//echo $request_header;exit;
curl_close($ch);
$data=json_decode($result,1);
print_r($data);
$arr=array();
for($i=0;$i<count($data['mainOrders']);$i++){
    $arr[$i]['order_id']=$data['mainOrders'][$i]['id'];
    $arr[$i]['title']=$data['mainOrders'][$i]['subOrders'][0]['itemInfo']['title'];
    $arr[$i]['itemUrl']=$data['mainOrders'][$i]['subOrders'][0]['itemInfo']['itemUrl'];
    $arr[$i]['pic']=$data['mainOrders'][$i]['subOrders'][0]['itemInfo']['pic'];
    $arr[$i]['readlTotal']=$data['mainOrders'][$i]['subOrders'][0]['priceInfo']['readlTotal'];
    $arr[$i]['quantity']=$data['mainOrders'][$i]['subOrders'][0]['priceInfo']['quantity'];
    $arr[$i]['createtime']=$data['mainOrders'][$i]['orderInfo']['createTime'];
    $arr[$i]['buyer_id']=$data['mainOrders'][$i]['buyer']['id'];
    $arr[$i]['phoneNum']=$data['mainOrders'][$i]['buyer']['phoneNum'];
    $arr[$i]['currency']=$data['mainOrders'][$i]['extra']['currency'];
    $arr[$i]['actualFee']=$data['mainOrders'][$i]['payInfo']['actualFee'];

}
jsonCreateTable($arr[0],"qc_shopro_mall_order","ymh");
jsonToTable($arr,"qc_shopro_mall_order","ymh","select id from ymh.qc_shopro_mall_order where order_id='{\$data['order_id']}'");